package cn.schoolwow.workflow.entity;

import cn.schoolwow.quickdao.annotation.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.time.LocalDateTime;

@Comment("工作流节点")
@CompositeIndex(columns = {"definitionId", "name"})
public class WorkFlowNode {
    @Id
    private long id;

    @Comment("工作流定义id")
    @Constraint(notNull = true)
    @ForeignKey(table = WorkFlowDefinition.class)
    private long definitionId;

    @Comment("节点名称")
    @Constraint(notNull = true)
    private String name;

    @Comment("节点类型,具体参见DeployNodeType枚举类")
    @Constraint(notNull = true)
    private Integer type;

    @Comment("网关位置,具体参见DeployGatewayPositionType枚举类")
    private Integer gatewayPosition;

    @Comment("审批人,格式为二维数组")
    private JSONArray assigner;

    @Comment("多人审批时处理方式,参见DeployApprovalType枚举类")
    private Integer approvalType;

    @Comment("元数据")
    private JSONObject meta;

    @Comment("审批超时时间-秒")
    private Integer timeout;

    @TableField(createdAt = true)
    private LocalDateTime createdAt;

    @TableField(updatedAt = true)
    private LocalDateTime updatedAt;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getDefinitionId() {
        return definitionId;
    }

    public void setDefinitionId(long definitionId) {
        this.definitionId = definitionId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getGatewayPosition() {
        return gatewayPosition;
    }

    public void setGatewayPosition(Integer gatewayPosition) {
        this.gatewayPosition = gatewayPosition;
    }

    public JSONArray getAssigner() {
        return assigner;
    }

    public void setAssigner(JSONArray assigner) {
        this.assigner = assigner;
    }

    public Integer getApprovalType() {
        return approvalType;
    }

    public void setApprovalType(Integer approvalType) {
        this.approvalType = approvalType;
    }

    public JSONObject getMeta() {
        return meta;
    }

    public void setMeta(JSONObject meta) {
        this.meta = meta;
    }

    public Integer getTimeout() {
        return timeout;
    }

    public void setTimeout(Integer timeout) {
        this.timeout = timeout;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }
}
